package net.jxvtc;


import net.jxvtc.ioc.ClientService;
import net.jxvtc.ioc.di.UserService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserServiceTest {

    ClassPathXmlApplicationContext context;

    @BeforeEach
    public  void init(){
        context=new ClassPathXmlApplicationContext("/spring-bean-02.xml");
    }

    @Test
    public void testSave(){
        UserService userServic = context.getBean("userService", UserService.class);
        userServic.save();
    }

    @Test
    public void testDisplay(){
        UserService userServic = context.getBean("userService1", UserService.class);
        userServic.display();
        UserService userServic2 = context.getBean("userService2", UserService.class);
        userServic2.display();
        UserService userServic3 = context.getBean("userService3", UserService.class);
        userServic3.display();
    }
}
